package com.jl.card.gp;

public class GPCommands {

	public GPCommands(int version) {

	}

	public byte[] makeInitializeUpdate(byte[] rand, int keyVersion, int keyID) {

		byte[] send = new byte[13];
		send[0] = (byte) 0x80;
		send[1] = (byte) 0x50;
		send[2] = (byte) (keyVersion & 0xFF);
		send[3] = (byte) (keyID & 0xFF);
		send[4] = (byte) 0x08;
		System.arraycopy(rand, 0, send, 5, 8);
		return send;
	}

	public byte[] makeExtendAuthenticated(byte[] hostCryptogram, int authLevel) {
		byte[] res = new byte[hostCryptogram.length + 5];
		res[0] = (byte) 0x84;
		res[1] = (byte) 0x82;
		res[2] = (byte) (authLevel & 0xFF);
		res[3] = (byte) 0x00;
		res[4] = (byte) 0x08;
		System.arraycopy(hostCryptogram, 0, res, 5, 8);
		return res;
	}
}
